import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const industryApi = urls.industry;

function listIndustry(param, page, pageSize, success, complete) {
  postRequest(industryApi.listIndustry + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function addIndustry(param, success, complete) {
  postRequest(industryApi.addIndustry, {}, param, success, complete)
}

function updateIndustry(param, success, complete) {
  postRequest(industryApi.updateIndustry, {}, param, success, complete)
}

function removeIndustry(ids, success, complete) {
  postRequest(industryApi.removeIndustry, {}, ids, success, complete)
}

function getIndustry(id, success, complete) {
  getRequest(industryApi.getIndustry + id, {}, success, complete)
}

function batchRemoveIndustry(ids, success, complete) {
  postRequest(industryApi.batchRemoveIndustry, {}, {ids: ids}, success, complete)
}

function listAll(success, complete){
  getRequest(industryApi.listAll,{},success,complete)
}

export default {
  listIndustry,
  addIndustry,
  updateIndustry,
  removeIndustry,
  getIndustry,
  batchRemoveIndustry,
  listAll
}
